package com.xxxy.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.xxxy.blockhandler.MonitorBlockHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: MonitorController
 * Package:
 * Description:
 *
 * @Author 软件232班——欧阳昊淼
 * @Create 2025/9/19 17:45
 * @Version 17.0.2
 */
@RestController
public class MonitorController {

    @GetMapping(value = "/monitor/hello")
    @SentinelResource(value = "helloResource", blockHandler = "helloBlockHandler",
            blockHandlerClass = MonitorBlockHandler.class)
    public String hello() {
        return "hello sentinel";
    }

    @GetMapping(value = "associate")
    public String associate() {
        return "我是关联接口";
    }

    @GetMapping(value = "/degrade")
    public String test_degrade_rt() throws InterruptedException {
        Thread.sleep(200);
        return "ok";
    }
}
